package com.xyoto.community.mapper.love;

import com.xyoto.community.entity.love.DynamicCommentReplyLove;
import com.xyoto.community.po.DynamicCommentReplyLoveCountPO;
import com.xyoto.community.po.MessageDynamicCommentReplyLovePO;
import com.xyoto.community.po.ReplyLoveCountPO;
import com.xyoto.community.po.UserDynamicCommentReplyLoveStatusPO;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 动态评论点赞表mapper
 *
 * @author lin
 */
public interface DynamicCommentReplyLoveMapper {

    /**
     * 根据用户id和动态评论回复id查询动态评论回复点赞记录
     *
     * @param userId
     * @param dynamicCommentReplyId
     * @return
     */
    DynamicCommentReplyLove selectOneByUserIdAndDynamicCommentReplyId(@Param("userId") Integer userId, @Param("dynamicCommentReplyId") Integer dynamicCommentReplyId);

    /**
     * 新增一条动态评论回复点赞记录
     * @param dynamicCommentReplyLove
     * @return
     */
    Integer insertOne(DynamicCommentReplyLove dynamicCommentReplyLove);

    /**
     *
     * @param dynamicCommentReplyLove 根据DynamicCommentReplyLove实体类去更新动态评论回复点赞记录mentReplyLove
     * @return
     */
    Integer updateDynamicCommentReplyLove(DynamicCommentReplyLove dynamicCommentReplyLove);

    /**
     * 取消动态评论回复点赞
     *
     * 复用updateDynamicCommentReplyLove方法
     * @param dynamicCommentReplyLove 实体
     * @return
     */
    @Deprecated
    Integer removeDynamicCommentReplyLove(DynamicCommentReplyLove dynamicCommentReplyLove);

    /**
     * 获取评论回复点赞个数
     * @param replyId 回复id
     * @param deleteStatus 删除状态
     * @return 评论回复点赞个数
     */
    Integer countCommentReplyLove(Integer replyId , Short deleteStatus);

    /**
     * 获取用户回复点赞状态
     * @param replyId 评论id
     * @param userId 用户id
     * @return 回复点赞状态
     */
    Short selectUserReplyLoveStatus(Integer replyId , Integer userId, Short deleteStatus);

    /**
     * 获取回复点赞信息
     * @param dynamicReplyLoveIds 回复点赞id集合
     * @return 回复点赞集合
     */
    List<MessageDynamicCommentReplyLovePO> getDynamicCommentReplyLoveListByIds(List<Integer> dynamicReplyLoveIds);

    /**
     * 统计指定用户id的所有动态评论回复获赞数
     * @param userId
     * @return
     */
    Integer countLoveByUerId(Integer userId);

    /**
     * 根据用户id和一组回复id，查出用户点赞的回复id
     *
     * @param userId
     * @param replyIdList
     * @return {@link List< Integer>}
     * @author 廖振辉
     */
    List<Integer> selectListByUserIdAndReply(@Param("userId") Integer userId, @Param("replyIdList") List<Integer> replyIdList);

    /**
     * 根据一组回复id获取对应的点赞数
     *
     * @param replyIdList
     * @return {@link List< ReplyLoveCountPO>}
     * @author 廖振辉
     */
    List<ReplyLoveCountPO> countLoveBatchReplyIds(@Param("replyIdList") List<Integer> replyIdList);

    /**
     * 根据动态评论回复id查询动态评论回复点赞数目
     * @param tarReplyIds
     * @return
     */
    List<DynamicCommentReplyLoveCountPO> getDynamicCommentReplyLoveCount(List<Integer> tarReplyIds);

    /**
     * 根据用户id，动态回复id查询用户对回复的点赞状态
     * @param userId
     * @param replyIdResult
     * @return
     *
     */
    List<UserDynamicCommentReplyLoveStatusPO> getUserDynamicCommentReplyLoveStatus(Integer userId, List<Integer> replyIdResult);

    List<DynamicCommentReplyLove> getAll(short loveStatus);
}
